<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="../Vue全家桶_stu/03_依赖包/vue.js"></script>
</head>

<body>
    <div id="root">
        <!-- 动态类名绑定三种写法  字符串，对象，数组  -->
        <!-- 字符串写法 -->
        <div :class="test1"></div><!-- class="a b c" -->
        <!-- 对象写法 -->
        <div :class="test2"></div><!-- class="a b" -->
        <!-- 数组写法 -->
        <div :class="test3"></div><!-- class="a b" -->
    </div>
    <script>
        const vm = new Vue({
            el: '#root',
            data() {
                return {
                    //字符串写法
                    test1: 'a b c',
                    //对象写法(属性值为真时为类名)
                    test2: {
                        a: true,
                        b: true,
                        c: false,
                        d: 0 //0可以隐式转换成false
                    },
                    //数组写法
                    test3: ['a', 'b']
                }
            }
        })
    </script>
</body>

</html>